using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class diet_menu_listMap : EntityTypeConfiguration<diet_menu_list>
    {
        public diet_menu_listMap()
        {
            // Primary Key
            this.HasKey(t => t.diet_menu_list_id);

            // Properties
            this.Property(t => t.diet_menu_list_type)
                .HasMaxLength(20);

            this.Property(t => t.diet_menu_list_content)
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("diet_menu_list");
            this.Property(t => t.energe_num).HasColumnName("energe_num");
            this.Property(t => t.diet_menu_list_id).HasColumnName("diet_menu_list_id");
            this.Property(t => t.diet_menu_list_type).HasColumnName("diet_menu_list_type");
            this.Property(t => t.diet_menu_list_content).HasColumnName("diet_menu_list_content");
            this.Property(t => t.diet_menu_id).HasColumnName("diet_menu_id");

            // Relationships
            this.HasOptional(t => t.diet_menu)
                .WithMany(t => t.diet_menu_list)
                .HasForeignKey(d => d.diet_menu_id);

        }
    }
}
